/*
 * @Author:shawnXiao
 * @Date: 2021-12-16 22:41:46
 * @LastEditTime: 2021-12-23 17:40:28
 * @FilePath: /vite2-vue3-typescript/src/plugins/setupAntd.ts
 */
// 按需引入组件
import {
  ConfigProvider,
  message,
  Button,
  Form,
  Input,
  Checkbox,
  Row,
  Col,
  Steps,
  Layout,
  Menu,
  Dropdown,
  Avatar,
  Modal,
  Tag,
  Badge,
  Radio,
  List,
  Table,
  Divider,
  Tooltip,
  Space,
  Tabs,
  Spin,
  Popover,
  Upload,
  Select,
  DatePicker,
  InputNumber,
  Pagination,
  Cascader,
  Card,
  Image,
  Progress,
  Switch,
  BackTop,
  Drawer,
  Statistic,
  Skeleton,
  Empty,
  Popconfirm,
  Descriptions,
} from 'ant-design-vue'

const components = [
  Button,
  Input,
  Layout,
  Menu,
  ConfigProvider,
  Form,
  Input,
  Checkbox,
  Row,
  Col,
  Steps,
  Layout,
  Menu,
  Dropdown,
  Avatar,
  Modal,
  Tag,
  Badge,
  Radio,
  List,
  Table,
  Divider,
  Tooltip,
  Space,
  Tabs,
  Spin,
  Popover,
  Upload,
  Select,
  DatePicker,
  InputNumber,
  Pagination,
  Cascader,
  Card,
  Image,
  Progress,
  Switch,
  BackTop,
  Drawer,
  Statistic,
  Skeleton,
  Empty,
  Popconfirm,
  Descriptions,
]

export function setupAntd(app: any) {
  const g = app.config.globalProperties
  g.$message = message
  g.$info = Modal.info
  g.$success = Modal.success
  g.$error = Modal.error
  g.$warning = Modal.warning
  g.$confirm = Modal.confirm

  components.forEach((component) => {
    app.use(component)
  })
}
